cmake_minimum_required(VERSION 3.14)

set(MYNAME vtkTest)

project(${MYNAME} VERSION 1.0)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(VTK REQUIRED COMPONENTS
    CommonColor
    CommonCore
    CommonSystem
    GUISupportQtQuick
    FiltersHybrid
    FiltersSources
    FiltersExtraction
    InteractionStyle
    RenderingContextOpenGL2
    RenderingCore
    RenderingFreeType
    RenderingGL2PSOpenGL2
    RenderingOpenGL2
    IOGeometry
    CommonDataModel
    FiltersCore
    IOLegacy
    IOPLY
    IOXML
    TestingCore
    TestingRendering
)

add_executable(${MYNAME}
    # proppicker.cpp
    # cellpicking.cpp
    # AddCell.cpp
    # HighlightSelection.cpp
    # coincident-topology-demo.cpp
    HardwareBlockPick.cpp
    # TestCompositePolyDataMapperPicking.cxx
    # TestCompositePolyDataMapperPickability.cxx
    # TestCompositePolyDataMapperMixedGeometryEdges.cxx
    # CameraOrientationWidget.cxx
)
target_link_libraries(${MYNAME} PRIVATE ${VTK_LIBRARIES})
vtk_module_autoinit(TARGETS ${MYNAME} MODULES ${VTK_LIBRARIES} )
# - Prevent the creation of a console window on Windows.
# - Create an application bundle on macOS.
#set_target_properties(${MYNAME} PROPERTIES
#    WIN32_EXECUTABLE ON
#    MACOSX_BUNDLE ON
#)

include(InstallRequiredSystemLibraries)
install(TARGETS ${MYNAME}
    BUNDLE DESTINATION .
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

install(
    TARGETS ${MYNAME}
    RUNTIME_DEPENDENCIES
        DIRECTORIES $<TARGET_FILE_DIR:VTK::CommonCore>;$<TARGET_FILE_DIR:Qt${VTK_QT_VERSION}::Core>
        PRE_EXCLUDE_REGEXES "api-ms-" "ext-ms-"  # don't install Windows-provided libs
        POST_EXCLUDE_REGEXES ".*system32/.*\\.dll"  # don't install Windows-provided libs
)